﻿using System;
using System.Collections;
using Const;
using UnityEngine;

public class Wall : MonoBehaviour
{
    
    public GameObject cubePrefab;
    private Cube[] _cubes;
    
    void Start()
    {
        _cubes = new Cube[Param.cubeCount];
        for (var i = 0; i < Param.cubeCount; i++)
        {
            var prefab = Instantiate(cubePrefab);
            prefab.transform.SetParent(transform);
            var cube = prefab.GetComponent<Cube>();
            cube.index = i;
            _cubes[i] = cube;
        }
    }

    public void ResetWall()
    {
        for (var i = 0; i < Param.cubeCount; i++)
        {
            var cube = _cubes[i];
            cube.index = i;
            cube.Init();
        }
    }



    
}